<template>
  <div class="newStyle">
    <div class="newTitle">
      <H1>{{newInfo.title}}</H1>
      <div>
        <span>发表时间:{{newInfo.add_time}}</span>
        <span>点击{{newInfo.click}}次</span>
      </div>
    </div>
    <div class="newComment" v-html="newInfo.content">
    </div>
    <commentVue :id="id"></commentVue>
  </div>
</template>

<script>
// console.log(this.$route)
// import commentVue from "../comment/Comment.vue";
export default {
  data() {
    return {
      id: this.$route.params.id,
      newInfo: {}
    };
  },
  created() {
    this.getInfo();
  },
  // components: {
  //   commentVue: commentVue
  // },
  methods: {
    getInfo() {
      this.$http.get("api/getnew/" + this.id).then(response => {
        if (response.body.status === 0) {
          this.newInfo = response.body.message[0];
        }
      });
    }
  }
};
</script>

<style lang="scss">
.newStyle {
  margin: 20px;
}
.newTitle {
  h1 {
    font-size: 16px;
    text-align: center;
  }
  div {
    display: flex;
    justify-content: space-between;
  }
}
</style>